package com.itheima.day3;

import java.util.Random;
import java.util.Scanner;

/**
 * 随机数猜数字
 */
public class Demo5 {
    public static void main(String[] args) {
        Random r= new Random();
        Scanner sc= new Scanner(System.in);
        int randomNum = r.nextInt(100) + 1;
        while (true){
            System.out.println("请输入您猜的数字");
            int num = sc.nextInt();
            if (num>randomNum){
                System.out.println("大了");
            }else if (num<randomNum){
                System.out.println("小了");
            }else {
                System.out.println("猜中了");
                break;
            }
        }
        System.out.println("感谢您的使用");
    }
}
